//
//  MsgItem.m
//  ChangChat
//
//  Created by Cocoa on 2019/8/28.
//  Copyright © 2019 yibai. All rights reserved.
//

#import "MsgItem.h"
#import <LKDBHelper/LKDBHelper.h>
#import "CacheHelper.h"
@implementation MsgItem

+ (NSDictionary *)mj_replacedKeyFromPropertyName {
    return @{@"ID": @"id"};
}

+ (NSString *)getPrimaryKey {
    return @"message_id";
}


- (NSString *)cellID {
    if (self.type == MsgType_Text) {
        return @"TextMsgCell";
    } else if (self.type == MsgType_Photo) {
        return @"ImageMsgCell";
    } else if (self.type == MsgType_Voice) {
        return @"VoiceMsgCell";
    } else if (self.type == MsgType_Video) {
        return @"VideoMsgCell";
    } else if (self.type == MsgType_File) {
        return @"FileMsgCell";
    } else if (self.type == MsgType_Card) {
        return @"CardMsgCell";
    } else if (self.type == MsgType_Time) {
        return @"TimeMsgCell";
    } else if (self.type == MsgType_Tip) {
        return @"TipMsgCell";
    } else {
        return @"TipMsgCell";
    }
}
- (NSString *)lastMsgTip {
    if (self.type == MsgType_Text) {
        return self.content;
    } else if (self.type == MsgType_Photo) {
        return @"[图片]";
    } else if (self.type == MsgType_Voice) {
        return @"[语音]";
    } else if (self.type == MsgType_Video) {
        return @"[视频]";
    } else if (self.type == MsgType_File) {
        return @"[文件]";
    } else if (self.type == MsgType_Card) {
        return @"[名片]";
    } else if (self.type == MsgType_Tip) {
        return self.content;
    }
    return @"";
}
- (NSString *)allFilePath {
    return [Cache_Help allFilePathWithMsgType:self.type fileName:self.filePath];
}
@end
